<?php
defined('IN_PHPCMS') or exit('No permission resources.');
pc_base::load_app_class('admin','admin',0);
class liuyan extends admin{
	function __construct() {
		parent::__construct();
		$this->M = new_html_special_chars(getcache('liuyan', 'commons'));
		$this->db = pc_base::load_model('liuyan_model');
		// $this->db2 = pc_base::load_model('type_model');
	}
	function init(){
		$where='';
		$page = $_GET['page'] ? intval($_GET['page']) : '1';
		 $data=$this->db->listinfo($where,'id desc', $page, 10);
		// var_dump($data);
		  $pages = $this->db->pages;
		  $i=1;
		include $this->admin_tpl('liuyan_list');
	}

	public function delete(){

		if(!empty($_POST['ids']) && is_array($_POST['ids'])){
			$ids = $_POST['ids'];
			for($i=0;$i<count($ids);$i++){
				$result = $this->db->delete(array('id'=>$ids[$i]));
			}
		}else{
			$ids = isset($_GET['ids']) && !empty($_GET['ids'])? $_GET['ids'] :'';
			$result = $this->db->delete(array('id'=>$ids));
		}
		
		if($result){
			showmessage(L('operation_success'),'?m=liuyan&c=liuyan');
		}else {
			showmessage(L("operation_failure"),'?m=liuyan&c=liuyan');
		}

	}

	
}